package com.gitee.lichoking.mysoap.common;

import lombok.Data;

import java.lang.reflect.Proxy;

/**
 * mapper代理类工厂
 *
 * @Author lich
 * @Date 2021/6/3
 **/
@Data
public class MapperProxyFactory<T> {
    private final Configuration configuration;
    private final Class<T> mapperInterface;

    public T newInstance(MapperProxy<T> mapperProxy) {
        ClassLoader classLoader = mapperInterface.getClassLoader();
        return (T) Proxy.newProxyInstance(mapperInterface.getClassLoader(), new Class[]{mapperInterface}, mapperProxy);
    }
}
